<template>
  <div class="my">
    <div class="myTop">
      <div class="top">
        <div class="sign_in">签到</div>
        <header @click="headerEvent">
          <div class="imgDiv">
            <img :src="info.avatar" alt />
          </div>
          <div>
            <p>{{ info.nickname }}</p>
            <p>
              Id:{{ info.uid }}
              <span>
                <van-icon name="edit" />
              </span>
            </p>
          </div>
        </header>
        <footer>
          <van-tabbar v-model="activeTwo">
            <van-tabbar-item @click="user_moneyEvent">
              <span>余额</span>
              <template #icon>
                <span class="price">{{ info.brokerage_price }}</span>
              </template>
            </van-tabbar-item>
            <van-tabbar-item @click="integralEvent">
              <span>积分</span>
              <template #icon>
                <span class="price">{{ info.integral }}</span>
              </template>
            </van-tabbar-item>
            <van-tabbar-item @click="user_couponEvent">
              <span>优惠券</span>
              <template #icon>
                <span class="price">{{ info.couponCount }}</span>
              </template>
            </van-tabbar-item>
          </van-tabbar>
        </footer>
      </div>
      <div class="center">
        <span>订单中心</span>
        <span @click="all">查看全部》</span>
      </div>
      <div class="list">
        <van-tabbar v-model="active" active-color="#000" inactive-color="#000">
          <van-tabbar-item
            :badge="v.num == 0 ? '' : v.num"
            v-for="(v, i) in item"
            :key="i"
            @click="tabEvent(i)"
          >
            <span>{{ v.name }}</span>
            <template #icon>
              <img :src="v.img" alt />
            </template>
          </van-tabbar-item>
        </van-tabbar>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from "vue";
import { listInfo, headerInfo } from "../../api/my";
const info = ref([]);
const list = ref([]);
headerInfo().then((res) => {
  console.log(res);
  info.value = res.data;
});
listInfo().then((res) => {
  // console.log(res);
  list.value = res.data;
});
</script>

<style lang="less" scoped>
.my {
  width: 100%;
  height: 100%;
  background: #eee;
  .myTop {
    width: 100%;
    height: 8.4267rem;
    padding: 15px;
    background: white;
    .top {
      width: 100%;
      height: 4.5333rem;
      border-radius: 0.2667rem;
      padding: 0.4rem;
      background: linear-gradient(
        90deg,
        rgb(246, 44, 44) 50%,
        rgb(249, 110, 41) 100%
      );
      position: relative;
      .sign_in {
        position: absolute;
        right: -0.16rem;
        top: 30%;
        width: 1.6rem;
        text-align: center;
        line-height: 0.8rem;
        border-radius: 14px 2px 2px 14px;
        color: #282828;
        font-size: 14px;
        font-weight: 700;
        height: 0.8rem;
        background: linear-gradient(90deg, #ffe157, #eec10f);
      }
      footer {
        margin-top: 0.4rem;
        .van-tabbar--fixed {
          position: static;
          background: none;
        }
        .van-tabbar-item--active {
          background: none;
          color: none;
        }
        span {
          color: #ccc;
        }
        .price {
          color: white;
        }
      }
      header {
        height: 1.7067rem;
        display: flex;
        p:nth-child(1) {
          font-size: 0.4267rem;
          color: white;
        }
        p:nth-child(2) {
          color: #ccc;
        }
        p {
          margin-left: 0.4rem;
          line-height: 0.8rem;
        }
        .imgDiv {
          width: 1.6rem;
          height: 1.6rem;
          img {
            width: 100%;
            height: 100%;
            border-radius: 50%;
          }
        }
      }
    }
    .center {
      width: 100%;
      height: 1.3333rem;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .list {
      width: 100%;
      height: 2.1333rem;
      .van-tabbar--fixed {
        position: static;
      }
    }
  }
}
</style>
